
import { createRouter, createWebHistory } from "vue-router";
const routes = [
    {
        path: "/",
        name: "Home",
        component: () => import("../views/home/index.vue"),
        meta: {
            title: "Home"
        }
    },
    {
        path: "/login",
        name: "Login",
        component: () => import("../views/login/index.vue"),
        meta: {
            title: "Login"
        }
    },
    /**@params {登录时的用户id}**/
    {
        path: "/user/:id",
        name: "User",
        component: () => import("../views/user/index.vue"),
        meta: {
            title: "userCenter"
        }
    },
    /**@params {key可以是id，uid，post_id等}**/
    {
        path: "/post/:key",
        name: "Post",
        component: () => import("../views/post/index.vue"),
        meta: {
            title: "Post"
        },
        /**@effect {帖子详情}*/
        // childrren: [
        //     {
        //         path: "/post/detail/:id",
        //         name: "Pdeatil",
        //         component: () => import(""),
        //         meta: {
        //             title: "detail"
        //         }
        //     }
        // ]
    },
    {
        path: "/goods",
        name: "Goods",
        component: () => import("../views/goods/index.vue"),
        meta: {
            title: "Goods"
        },
        // children: [
        //     {
        //         path: "/goods/detail/:id",
        //         name: "Getail",
        //         component: () => import(""),
        //         meta: {
        //             title: "details"
        //         }
        //     }
        // ]
    },
    /**@params key:搜索时携带的关键字**/
    {
        path: "/search",
        name: "SDetail",
        component: () => import("../views/searchDeatil/index.vue"),
        meta: {
            title: "Search"
        }
    },


]

const router = createRouter({
    history: createWebHistory(),
    routes,
});
// router.beforeEach((to, from, next) => {
//     // 需要登录的逻辑
// })
export default router;

